package atom;

import java.util.concurrent.Semaphore;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-10-24
 * Time: 20:41
 */

public class Demo4 {
    public static void main(String[] args) throws InterruptedException {
        //初始化的值表示可用资个数
        Semaphore semaphore = new Semaphore(4);

        //申请资源 p操作 可以写参数
        semaphore.acquire();

        //释放资源 v操作
        semaphore.release();
    }
}
